<route lang="json5" type="home">
{
  layout: 'tabbar',
  style: {
    navigationStyle: 'custom',
    navigationBarTitleText: '首页',
    navigationBarBackgroundColor: '#3287e1',
    navigationBarTextStyle:'white',
    enablePullDownRefresh:false
  },
}
</route>

<script lang="ts" setup>
defineOptions({
  name: 'Result',
})

const notice = '尊敬的商户，感谢您对平台信赖和支持！请在合法合规下使用本平台，如有发现利用平台从事非法行为我们将配合相关部门协助调查！如有从事非法行为的商户请绕道本平台，我们坚决打击和永久封号处理！平台致力于免费提供自助设备数字化管理SAAS系统平台，并不间断的持续开发、升级软硬件，以力求能满足各行业的需求和使用！'
const deviceTag = [
  {
    title: '绑定设备',
    desc: '扫主机绑定码',
    icon: 'scan',
    url: '',
    bg: 'bg1',
    type: 'scan',
  },
  {
    title: '设备列表',
    desc: '配置、详情、派币',
    icon: 'fork',
    url: '/pages-sub/device/deviceList',
    bg: 'bg2',
  },
  {
    title: '支付套餐',
    desc: '便于支付优惠政策',
    icon: 'copy',
    url: '/pages-sub/device/payList',
    bg: 'bg3',
  },
  {
    title: '标签分组',
    desc: '对设备设置标签管理',
    icon: 'star',
    url: '/pages-sub/device/labelGroup',
    bg: 'bg4',

  },
  {
    title: '门店管理',
    desc: '对设备划分门店管理',
    icon: 'bags',
    url: '/pages-sub/device/storeManage',
    bg: 'bg5',
  },
  {
    title: '更多功能',
    icon: 'app',
    url: '',
    bg: 'bg6',
  },
]
const financeTag = [
  {
    title: '收款模板',
    icon: 'file-copy',
    url: '/pages-sub/finance/tplList',
    bg: 'bg7',
  },
  {
    title: '收款教程',
    icon: 'play-circle-stroke',
    url: '',
    bg: 'bg8',
  },
  {
    title: '支付日志',
    icon: 'evaluation',
    url: '/pages-sub/finance/payRecord',
    bg: 'bg9',
  },
  {
    title: '购币日志',
    icon: 'books',
    url: '/pages-sub/finance/buyRecord',
    bg: 'bg10',

  },
  {
    title: '派币日志',
    icon: 'evaluation',
    url: '/pages-sub/finance/pbRecord',
    bg: 'bg11',
  },
  {
    title: '更多功能',
    icon: 'app',
    url: '',
    bg: 'bg6',
  },
]
const otherTag = [
  {
    title: '会员管理',
    icon: 'creditcard',
    url: '/pages-sub/finance/vipList',
    bg: 'bg12',
  },
  {
    title: '子账号',
    icon: 'usergroup',
    url: '/pages-sub/basic/submch',
    bg: 'bg2',
  },
  {
    title: '进销存',
    icon: 'view-module',
    url: '/pages-sub/basic/psi',
    bg: 'bg8',
  },
  {
    title: '积分管理',
    icon: 'gift',
    url: '',
    bg: 'bg13',

  },
  {
    title: '我的商城',
    icon: 'shop',
    url: '',
    bg: 'bg14',
  },
  {
    title: '更多功能',
    icon: 'app',
    url: '',
    bg: 'bg6',
  },
]
const handleClick: (item: any) => void = (item) => {
  if (item.type === 'scan') {
    uni.scanCode({
      success: (res) => {
        console.log(res)
        if (res.result) {
          uni.showToast({
            title: '绑定成功',
            icon: 'success',
          })
        }
        else {
          uni.showToast({
            title: '绑定失败',
            icon: 'none',
          })
        }
      },
    })
  }
  else if (item.url) {
    uni.navigateTo({
      url: item.url,
    })
  }
  else {
    uni.showToast({
      title: '功能未开发',
      icon: 'none',
    })
  }
}
</script>

<template>
  <view class="top">
    <view class="income">
      <view class="title">
        今日收益
      </view>
      <view class="num">
        100.00<span class="unit">元</span>
      </view>
    </view>
    <view class="more">
      <wd-row>
        <wd-col :span="8">
          <view>今日投币</view>
          <view class="pt-1">
            0
          </view>
        </wd-col>
        <wd-col :span="8">
          <view>今日投币</view>
          <view class="pt-1">
            0
          </view>
        </wd-col>
        <wd-col :span="8">
          <view>今日投币</view>
          <view class="pt-1">
            0
          </view>
        </wd-col>
      </wd-row>
    </view>
  </view>
  <wd-notice-bar :text="notice" prefix="sound" />
  <view class="option-list">
    <view class="title">
      设备管理
    </view>
    <wd-row>
      <wd-col v-for="(item, index) in deviceTag" :key="index" :span="8">
        <view class="item" @click="handleClick(item)">
          <wd-icon :name="item.icon" :custom-class="`icon-circle ${item.bg}`" />
          <view class="$menu-title1">
            {{ item.title }}
          </view>
        </view>
      </wd-col>
    </wd-row>
  </view>

  <view class="option-list">
    <view class="title">
      财务管理
    </view>
    <wd-row>
      <wd-col v-for="(item, index) in financeTag" :key="index" :span="8">
        <view class="item" @click="handleClick(item)">
          <wd-icon :name="item.icon" :custom-class="`icon-circle ${item.bg}`" />
          <view class="$menu-title1">
            {{ item.title }}
          </view>
        </view>
      </wd-col>
    </wd-row>
  </view>

  <view class="option-list">
    <view class="title">
      其他功能
    </view>
    <wd-row>
      <wd-col v-for="(item, index) in otherTag" :key="index" :span="8">
        <view class="item" @click="handleClick(item)">
          <wd-icon :name="item.icon" :custom-class="`icon-circle ${item.bg}`" />
          <view class="$menu-title1">
            {{ item.title }}
          </view>
        </view>
      </wd-col>
    </wd-row>
  </view>
  <!-- <navigator
    class="i-bottom"
    url="/pages/wallet/wallet"
  >
    <wd-button custom-class="custom-shadow" block>
      返回投币
    </wd-button>
  </navigator> -->
</template>

<style lang="scss" scoped>
    .top {
      color:#ffffff;
      text-align: center;

      .income {
        padding: 80rpx 0;
        background-color: #2a90ff;
        padding-top: calc(80rpx + var(--status-bar-height));
        .title {
          font-size: 30rpx;
        }
        .num{
          font-size: 60rpx;
        }
        .unit{
          font-size: 24rpx;
        }
      }
      .more{
        background: #26a2ff;
        padding: 20rpx;
        margin-top: -1px;
      }
    }
</style>
